package com.hntx.joymusic.util;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

public class UserInfoUtils {

    public static String getUserInfo(Context context, String name) {
        String value = null;
        Uri uri = Uri.parse("content://stbconfig/authentication");
        Cursor mCursor = context.getContentResolver()
                .query(uri, null, null, null, null);
        if (mCursor != null) {
            while (mCursor.moveToNext()) {
                String names = mCursor.getString(mCursor.getColumnIndex("name"));
                if (names.equals(name)) {
                    value = mCursor.getString(mCursor.getColumnIndex("value"));
                    break;
                }
            }
            mCursor.close();
        }
        return value;
    }

    public static String getUserAuthInfos(Context context, String name) {
        String value = null;
        Uri uri = Uri.parse("content://stbauthinfo/authentication");
        Cursor mCursor = context.getContentResolver()
                .query(uri, null, null, null, null);
        if (mCursor != null) {
            while (mCursor.moveToNext()) {
                String names = mCursor.getString(mCursor.getColumnIndex("name"));
                if (names.equals(name)) {
                    value = mCursor.getString(mCursor.getColumnIndex("value"));
                    break;
                }
            }
            mCursor.close();
        }
        return value;
    }

    //sXX
    public static void getUserInfo(Context context) {
        Cursor cursor = context.getContentResolver().query(Uri.parse("content://com.cmhi.softmbh.provider/data"), null, null, null, null);
        if (null != cursor) {
            cursor.moveToFirst();
            String username = cursor.getString(1);//用户名
            String sss = cursor.getString(2);//用户名
            String ssss = cursor.getString(3);//用户名
            String sssss = cursor.getString(6);//用户名
            String ssssss = cursor.getString(10);//用户名
            String stbid = cursor.getString(4);//STBID
            String virtual_mac = cursor.getString(5);//虚拟MAC地址
            String province_id = cursor.getString(7);//省份ID
            String os_version = cursor.getString(8);//设备版本
            String four_thousand = cursor.getString(9);//4K
            String stb_type = cursor.getString(11);//终端类型
            String setting_action = cursor.getString(13);//设置功能类名名
            String setting_package = cursor.getString(14);//设置功能包名
        }
    }
}
